package com.xbongbong.saas.enums;

import lombok.Getter;

import java.util.Objects;

/**
 * @author haibin.zhang
 * @version v1.0
 * @date 2019/3/4 10:14
 * @since v1.0
 */
@Getter
public enum ListBusinessTypeEnum {
    CUSTOMER_MANAGEMENT(XbbRefTypeEnum.CUSTOMER_MANAGEMENT.getCode(),XbbRefTypeEnum.CUSTOMER_MANAGEMENT.getCode()),
    CUSTOMER(XbbRefTypeEnum.CUSTOMER.getCode(),XbbRefTypeEnum.CUSTOMER_MANAGEMENT.getCode()),
    CUSTOMER_FOCUS(XbbRefTypeEnum.CUSTOMER_FOCUS.getCode(),XbbRefTypeEnum.CUSTOMER_MANAGEMENT.getCode()),
    CUSTOMER_DEAL(XbbRefTypeEnum.CUSTOMER_DEAL.getCode(),XbbRefTypeEnum.CUSTOMER_MANAGEMENT.getCode()),
    CUSTOMER_FOLLOW(XbbRefTypeEnum.CUSTOMER_FOLLOW.getCode(),XbbRefTypeEnum.CUSTOMER_MANAGEMENT.getCode()),
    CUSTOMER_PUBLIC(XbbRefTypeEnum.CUSTOMER_PUBLIC.getCode(),XbbRefTypeEnum.CUSTOMER_MANAGEMENT.getCode()),
    CUSTOMER_RECYCLE(XbbRefTypeEnum.CUSTOMER_RECYCLE.getCode(),XbbRefTypeEnum.CUSTOMER_MANAGEMENT.getCode()),
    CUSTOMER_NEARBY(XbbRefTypeEnum.CUSTOMER_NEARBY.getCode(),XbbRefTypeEnum.CUSTOMER_MANAGEMENT.getCode()),
    CUSTOMER_DUPLICATE(XbbRefTypeEnum.CUSTOMER_DUPLICATE.getCode(),XbbRefTypeEnum.CUSTOMER_MANAGEMENT.getCode()),
    CONTRACT(XbbRefTypeEnum.CONTRACT.getCode(),XbbRefTypeEnum.CONTRACT.getCode()),
    REFUND(XbbRefTypeEnum.REFUND.getCode(),XbbRefTypeEnum.REFUND.getCode()),
    SALES_OPPORTUNITY(XbbRefTypeEnum.SALES_OPPORTUNITY.getCode(),XbbRefTypeEnum.SALES_OPPORTUNITY.getCode()),
    ALL_OPPORTUNITY(XbbRefTypeEnum.ALL_OPPORTUNITY.getCode(),XbbRefTypeEnum.SALES_OPPORTUNITY.getCode()),
    KEY_OPPORTUNITY(XbbRefTypeEnum.KEY_OPPORTUNITY.getCode(),XbbRefTypeEnum.SALES_OPPORTUNITY.getCode()),
    CONTACT(XbbRefTypeEnum.CONTACT.getCode(),XbbRefTypeEnum.CONTACT.getCode()),
    CONTACT_DUPLICATE(XbbRefTypeEnum.CONTACT_DUPLICATE.getCode(),XbbRefTypeEnum.CONTACT.getCode()),
    CUSTOMER_COMMUNICATE(XbbRefTypeEnum.CUSTOMER_COMMUNICATE.getCode(),XbbRefTypeEnum.CUSTOMER_COMMUNICATE.getCode()),
    COMMUNICATE_PLAN(XbbRefTypeEnum.COMMUNICATE_PLAN.getCode(),XbbRefTypeEnum.COMMUNICATE_PLAN.getCode()),
    PAYMENT(XbbRefTypeEnum.PAYMENT.getCode(),XbbRefTypeEnum.PAYMENT.getCode()),
    PAY_PLAN(XbbRefTypeEnum.PAY_PLAN.getCode(),XbbRefTypeEnum.PAY_PLAN.getCode()),
    INVOICE(XbbRefTypeEnum.INVOICE.getCode(),XbbRefTypeEnum.INVOICE.getCode()),
    PURCHASE_INVOICE(XbbRefTypeEnum.PURCHASE_INVOICE.getCode(),XbbRefTypeEnum.PURCHASE_INVOICE.getCode()),
    WORK_REPORT(XbbRefTypeEnum.WORK_REPORT.getCode(),XbbRefTypeEnum.WORK_REPORT.getCode()),
    WORKREPORT_DAILY(XbbRefTypeEnum.WORKREPORT_DAILY.getCode(),XbbRefTypeEnum.WORK_REPORT.getCode()),
    WORKREPORT_WEEKLY(XbbRefTypeEnum.WORKREPORT_WEEKLY.getCode(),XbbRefTypeEnum.WORK_REPORT.getCode()),
    WORKREPORT_MONTHLY(XbbRefTypeEnum.WORKREPORT_MONTHLY.getCode(),XbbRefTypeEnum.WORK_REPORT.getCode()),
    SUPPLIER(XbbRefTypeEnum.SUPPLIER.getCode(),XbbRefTypeEnum.SUPPLIER.getCode()),
    SUPPLIER_CONTACT(XbbRefTypeEnum.SUPPLIER_CONTACT.getCode(),XbbRefTypeEnum.SUPPLIER_CONTACT.getCode()),
    SUPPLIER_COMMUNICATE(XbbRefTypeEnum.SUPPLIER_COMMUNICATE.getCode(),XbbRefTypeEnum.SUPPLIER_COMMUNICATE.getCode()),
    PURCHASE(XbbRefTypeEnum.PURCHASE.getCode(),XbbRefTypeEnum.PURCHASE.getCode()),
    RETURNED_PURCHASE(XbbRefTypeEnum.RETURNED_PURCHASE.getCode(),XbbRefTypeEnum.RETURNED_PURCHASE.getCode()),
    BOM_BILL(XbbRefTypeEnum.BOM_BILL.getCode(),XbbRefTypeEnum.BOM_BILL.getCode()),
    PRODUCTION_ORDER(XbbRefTypeEnum.PRODUCTION_ORDER.getCode(),XbbRefTypeEnum.PRODUCTION_ORDER.getCode()),
    ASSEMBLE(XbbRefTypeEnum.ASSEMBLE.getCode(),XbbRefTypeEnum.ASSEMBLE.getCode()),
    INSTOCK(XbbRefTypeEnum.INSTOCK.getCode(),XbbRefTypeEnum.INSTOCK.getCode()),
    PURCHASE_INSTOCK(XbbRefTypeEnum.PURCHASE_INSTOCK.getCode(),XbbRefTypeEnum.PURCHASE_INSTOCK.getCode()),
    REFUND_INSTOCK(XbbRefTypeEnum.REFUND_INSTOCK.getCode(),XbbRefTypeEnum.REFUND_INSTOCK.getCode()),
    OTHER_INSTOCK(XbbRefTypeEnum.OTHER_INSTOCK.getCode(),XbbRefTypeEnum.OTHER_INSTOCK.getCode()),
    PRODUCTION_INSTOCK(XbbRefTypeEnum.PRODUCTION_INSTOCK.getCode(),XbbRefTypeEnum.PRODUCTION_INSTOCK.getCode()),
    RETURNED_MATERIEL_INSTOCK(XbbRefTypeEnum.RETURNED_MATERIEL_INSTOCK.getCode(),XbbRefTypeEnum.RETURNED_MATERIEL_INSTOCK.getCode()),
    OUTSTOCK(XbbRefTypeEnum.OUTSTOCK.getCode(),XbbRefTypeEnum.OUTSTOCK.getCode()),
    CONTRACT_OUTSTOCK(XbbRefTypeEnum.CONTRACT_OUTSTOCK.getCode(),XbbRefTypeEnum.CONTRACT_OUTSTOCK.getCode()),
    RETURNED_PURCHASE_OUTSTOCK(XbbRefTypeEnum.RETURNED_PURCHASE_OUTSTOCK.getCode(),XbbRefTypeEnum.RETURNED_PURCHASE_OUTSTOCK.getCode()),
    OTHER_OUTSTOCK(XbbRefTypeEnum.OTHER_OUTSTOCK.getCode(),XbbRefTypeEnum.OTHER_OUTSTOCK.getCode()),
    PRODUCTION_MATERIEL_OUTSTOCK(XbbRefTypeEnum.PRODUCTION_MATERIEL_OUTSTOCK.getCode(),XbbRefTypeEnum.PRODUCTION_MATERIEL_OUTSTOCK.getCode()),
    WORK_ORDER_OUTSTOCK(XbbRefTypeEnum.WORK_ORDER_OUTSTOCK.getCode(), XbbRefTypeEnum.WORK_ORDER_OUTSTOCK.getCode()),
    INVENTORY(XbbRefTypeEnum.INVENTORY.getCode(),XbbRefTypeEnum.INVENTORY.getCode()),
    TRANSFER(XbbRefTypeEnum.TRANSFER.getCode(),XbbRefTypeEnum.TRANSFER.getCode()),
    WAREHOUSE(XbbRefTypeEnum.WAREHOUSE.getCode(),XbbRefTypeEnum.WAREHOUSE.getCode()),
    WAIT_OUTSTOCK(XbbRefTypeEnum.WAIT_OUTSTOCK.getCode(),XbbRefTypeEnum.CONTRACT.getCode()),
    WAIT_INSTOCK_PURCHASE(XbbRefTypeEnum.WAIT_INSTOCK_PURCHASE.getCode(),XbbRefTypeEnum.PURCHASE.getCode()),
    WAIT_PURCHASE(XbbRefTypeEnum.WAIT_PURCHASE.getCode(),XbbRefTypeEnum.CONTRACT.getCode()),
    WAIT_PRODUCE(XbbRefTypeEnum.WAIT_PRODUCE.getCode(),XbbRefTypeEnum.CONTRACT.getCode()),
    PRODUCT(XbbRefTypeEnum.PRODUCT.getCode(),XbbRefTypeEnum.PRODUCT.getCode()),
    STOCK_SEARCH(XbbRefTypeEnum.STOCK_SEARCH.getCode(), XbbRefTypeEnum.PRODUCT.getCode()),
    WARNING_SEARCH(XbbRefTypeEnum.WARNING_SEARCH.getCode(), XbbRefTypeEnum.PRODUCT.getCode()),
    GUARANTEE_SEARCH(XbbRefTypeEnum.GUARANTEE_SEARCH.getCode(), XbbRefTypeEnum.PRODUCT.getCode()),
    QUOTATION(XbbRefTypeEnum.QUOTATION.getCode(), XbbRefTypeEnum.QUOTATION.getCode()),
    PREPAYMENT_BLANCE(XbbRefTypeEnum.PREPAYMENT_BALANCE.getCode(), XbbRefTypeEnum.PREPAYMENT_BALANCE.getCode()),
    PAYMENT_SHEET(XbbRefTypeEnum.PAYMENT_SHEET.getCode(), XbbRefTypeEnum.PAYMENT_SHEET.getCode()),
    REIMBURSEMENT_FORM(XbbRefTypeEnum.REIMBURSEMENT_FORM.getCode(), XbbRefTypeEnum.REIMBURSEMENT_FORM.getCode()),
    EXPENSE(XbbRefTypeEnum.EXPENSE.getCode(), XbbRefTypeEnum.EXPENSE.getCode()),
    PAY_SHEET(XbbRefTypeEnum.PAY_SHEET.getCode(), XbbRefTypeEnum.PAY_SHEET.getCode()),
    PREPAYM_BLANCE(XbbRefTypeEnum.PREPAY_BALANCE.getCode(), XbbRefTypeEnum.PREPAY_BALANCE.getCode()),
    OTHER_INCOME(XbbRefTypeEnum.OTHER_INCOME.getCode(), XbbRefTypeEnum.OTHER_INCOME.getCode()),
    OTHER_EXPENSE(XbbRefTypeEnum.OTHER_EXPENSE.getCode(), XbbRefTypeEnum.OTHER_EXPENSE.getCode()),
    FUND_TRANSFER(XbbRefTypeEnum.FUND_TRANSFER.getCode(), XbbRefTypeEnum.FUND_TRANSFER.getCode()),
    STOCK_FLOW_BILL(XbbRefTypeEnum.STOCK_FLOW_BILL.getCode(), XbbRefTypeEnum.STOCK_FLOW_BILL.getCode()),
    STOCK_STANDING_BOOK(XbbRefTypeEnum.STOCK_STANDING_BOOK.getCode(), XbbRefTypeEnum.STOCK_STANDING_BOOK.getCode()),
    PAYMENT_TASK(XbbRefTypeEnum.PAYMENT_TASK.getCode(), XbbRefTypeEnum.PAYMENT_TASK.getCode()),
    BATCH_FLOW_BILL(XbbRefTypeEnum.BATCH_FLOW_BILL.getCode(), XbbRefTypeEnum.BATCH_FLOW_BILL.getCode()),
    CREDIT_LIMIT(XbbRefTypeEnum.CREDIT_LIMIT.getCode(), XbbRefTypeEnum.CREDIT_LIMIT.getCode()),
    CREDIT_FIXED_LIMIT(XbbRefTypeEnum.CREDIT_FIXED_LIMIT.getCode(), XbbRefTypeEnum.CREDIT_FIXED_LIMIT.getCode()),
    CREDIT_TEMPORARY_LIMIT(XbbRefTypeEnum.CREDIT_TEMPORARY_LIMIT.getCode(), XbbRefTypeEnum.CREDIT_TEMPORARY_LIMIT.getCode()),
    SEQ_SEARCH(XbbRefTypeEnum.SEQ_SEARCH.getCode(), XbbRefTypeEnum.SEQ_SEARCH.getCode()),
    MARKET_ACTIVITY(XbbRefTypeEnum.MARKET_ACTIVITY.getCode(),XbbRefTypeEnum.MARKET_ACTIVITY.getCode()),
    CLUE(XbbRefTypeEnum.CLUE.getCode(),XbbRefTypeEnum.CLUE.getCode()),
    ALL_CLUE(XbbRefTypeEnum.ALL_CLUE.getCode(),XbbRefTypeEnum.CLUE.getCode()),
    CLUE_PUBLIC(XbbRefTypeEnum.CLUE_PUBLIC.getCode(),XbbRefTypeEnum.CLUE.getCode()),
    CLUE_RECYCLE(XbbRefTypeEnum.CLUE_RECYCLE.getCode(),XbbRefTypeEnum.CLUE.getCode()),
    CLUE_DUPLICATE(XbbRefTypeEnum.CLUE_DUPLICATE.getCode(),XbbRefTypeEnum.CLUE.getCode()),
    DISTRIBUTOR_ACCOUNT(XbbRefTypeEnum.DISTRIBUTOR_ACCOUNT.getCode(), XbbRefTypeEnum.DISTRIBUTOR_ACCOUNT.getCode()),
    ONLINE_PAYMENT_FLOW(XbbRefTypeEnum.ONLINE_PAYMENT_FLOW.getCode(), XbbRefTypeEnum.ONLINE_PAYMENT_FLOW.getCode()),
    SLA_LOG(XbbRefTypeEnum.SLA_LOG.getCode(),XbbRefTypeEnum.SLA_LOG.getCode()),
    COMPETITOR(XbbRefTypeEnum.COMPETITOR.getCode(),XbbRefTypeEnum.COMPETITOR.getCode())
    ;

    private Integer subBusinessType;
    private Integer businessType;

    ListBusinessTypeEnum(Integer subBusinessType, Integer businessType) {
        this.subBusinessType = subBusinessType;
        this.businessType = businessType;
    }

    /**
     * 获取业务类型
     * @param subBusinessType 子业务类型
     * @return
     */
    public static Integer getBusinessType(Integer subBusinessType){
        for (ListBusinessTypeEnum listBusinessTypeEnum : values()){
            if (Objects.equals(subBusinessType,listBusinessTypeEnum.subBusinessType)){
                return listBusinessTypeEnum.businessType;
            }
        }
        return 0;
    }
}
